const express = require('express');
const router = express.Router();
const orderAddressController = require('../controllers/order_address');
const authMiddleware = require('../middleware/auth');

// 保存订单地址信息 (无需令牌校验)
router.post('/', orderAddressController.saveOrderAddress);

// 获取全部订单地址信息
router.get('/all', authMiddleware.authenticateAdmin, orderAddressController.getAllOrderAddresses);

// 获取订单地址信息
router.get('/', authMiddleware.authenticateAdmin, orderAddressController.getOrderAddress);

// 更新订单地址信息
router.put('/', authMiddleware.authenticateAdmin, orderAddressController.updateOrderAddress);

// 删除订单地址信息
router.delete('/', authMiddleware.authenticateAdmin, orderAddressController.deleteOrderAddress);

// 根据条件搜索订单地址信息
router.get('/search', authMiddleware.authenticateAdmin, orderAddressController.searchOrderAddresses);

module.exports = router;